//package com.yycx.app.boot.handler.app;
//
//import com.yycx.common.base.entity.EntityMap;
//import com.yycx.common.mybatis.interceptor.PageInterceptor;
//import com.yycx.common.mybatis.model.PageParams;
//import com.yycx.common.mybatis.model.ResultBody;
//import com.yycx.common.mybatis.query.CriteriaQuery;
//import com.yycx.common.security.OpenHelper;
//import com.yycx.module.pay.provider.service.PayBalanceLogService;
//import com.yycx.module.user.client.entity.AppUser;
//import com.yycx.module.user.provider.service.AppUserService;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.math.BigDecimal;
//import java.util.List;
//import java.util.Optional;
//
///**
// * 我的邀请用户
// *
// * @author zyf
// */
//@Component("shareUserListHandler")
//public class ShareUserListHandler implements PageInterceptor<AppUser> {
//
//    @Resource
//    private PayBalanceLogService payBalanceLogService;
//
//    @Resource
//    private AppUserService userService;
//
//    @Override
//    public ResultBody validate(CriteriaQuery cq, EntityMap params) {
//        return ResultBody.ok();
//    }
//
//
//    @Override
//    public void complete(CriteriaQuery<AppUser> cq, List<EntityMap> result, EntityMap extra) {
//        Long userId = OpenHelper.getUserId();
//        AppUser appUser = userService.getUserById(userId);
//        //查询总收益
//        BigDecimal totalAmount = payBalanceLogService.totalAmountByLogType(userId, 1);
//        extra.put("totalAmount", totalAmount);
//        String shareUrl = "https://api.hswlm.cn/api/common/register/" + Optional.ofNullable(appUser.getShareCode()).orElse("");
//        extra.put("shareUrl", shareUrl);
//        extra.put("shareTitle", "推荐注册");
//        extra.put("shareDesc", "用户分享注册");
//        long userCount = userService.countByInviterId(userId);
//        extra.put("userCount", userCount);
//
//    }
//
//    @Override
//    public void prepare(CriteriaQuery cq, PageParams pageParams, EntityMap params) {
//        Long userId = OpenHelper.getUserId();
//        cq.eq(true, "inviterId", userId);
//    }
//}
